/*
 * Matrix.h
 *
 *  Created on: 29/04/2011
 *      Author: Rafael
 */

#ifndef MATRIX_H_
#define MATRIX_H_

#include <cstdlib>

template <class entity_type>
class Matrix {
private:
	entity_type *matrix;
	int rows;
	int columns;
public:
	virtual ~Matrix(){
		if(matrix != NULL){
			delete[] matrix;
		}
	}
	Matrix(int rows, int columns){
		this->rows = rows;
		this->columns = columns;

		matrix = new entity_type[rows*columns];
	}
	/*
	 * Methods
	 */
	void add(int i, int j, entity_type entity){
		matrix[i*columns + j] = entity;
	}
	entity_type get(int i, int j){
		return matrix[i*columns + j];
	}

	int GetRows() const{
		return rows;
	}
	int GetColumns() const{
		return columns;
	}
};

#endif /* MATRIX_H_ */
